package models

import (
	"time"
)

type Image struct {
	ID         uint      `gorm:"primaryKey" json:"id"`
	Title      string    `gorm:"not null" json:"title"`
	Filename   string    `gorm:"not null" json:"filename"`
	UserID     uint      `gorm:"not null" json:"user_id"`
	CategoryID *uint     `json:"category_id"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`

	User     User     `gorm:"foreignKey:UserID" json:"user"`
	Category Category `gorm:"foreignKey:CategoryID" json:"category"`
	Tags     []Tag    `gorm:"many2many:image_tags;" json:"tags"`
}
